{extend name="../../common/view/base" /}

{block name="content"}
<div class="panel panel-default panel-intro">
    <div class="panel-heading">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#t-all" data-toggle="tab">{:__('All')}</a></li>
        </ul>
    </div>
    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="t-all">
                <div class="widget-body no-padding">
                    <div id="toolbar" class="toolbar">
                        <a class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
                        <a class="btn btn-success btn-add" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
                        <a class="btn btn-success btn-edit btn-disabled disabled" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
                        <a class="btn btn-danger btn-del btn-disabled disabled" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
                    </div>
                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                           data-operate-edit="{:$auth->check('pt/leader/edit')}"
                           data-operate-del="{:$auth->check('pt/leader/del')}"
                           width="100%">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script>
$(function () {
    var table = $("#table");

    // 初始化表格
    table.bootstrapTable({
        url: 'pt/leader/index',
        pk: 'id',
        sortName: 'id',
        columns: [
            [
                {checkbox: true},
                {field: 'id', title: 'ID', sortable: true},
                {field: 'nickname', title: '组长姓名', operate: 'LIKE'},
                {field: 'username', title: '用户名', operate: 'LIKE'},
                {field: 'email', title: '邮箱', operate: 'LIKE'},
                {field: 'mobile', title: '手机号', operate: 'LIKE'},
                {field: 'createtime', title: '创建时间', operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
            ]
        ]
    });

    // 为表格绑定事件
    Table.api.bindevent(table);
});
</script>
{/block}
